package com.wanter.common.utils.user;

/**
 * 用户性别工具类
 */
public class UserUtils {
    private static final String BOY_STRTING_GANDER = "男";
    private static final String GRIL_STRING_GANDER = "女";
    private static final int BOY_INT_GANDER = 1;
    private static final int GRIL_INT_GANDER = 2;

    /**
     * 根据代号拿到性别
     *
     * @param gander 性别代号
     * @return 真实性别
     */
    public static String getGander(int gander) {
        switch (gander) {
            case BOY_INT_GANDER:
                return BOY_STRTING_GANDER;
            case GRIL_INT_GANDER:
                return GRIL_STRING_GANDER;
        }
        return "性别未知";
    }

    /**
     * 根据代号拿到性别
     *
     * @param gander 性别代号
     * @return 真实性别
     */
    public static int getGander(String gander){
        if(gander.equals(BOY_STRTING_GANDER)){
            return BOY_INT_GANDER;
        }else if (gander.equals(GRIL_STRING_GANDER)){
            return GRIL_INT_GANDER;
        }
        return -1;
    }

}
